<jsp:useBean id="korisnik"
	type="rs.ac.uns.ftn.informatika.mbs2.e11031.etaksi.entitet.Korisnik"
	scope="session" />
<jsp:useBean id="putnici"
	type="java.util.Collection<rs.ac.uns.ftn.informatika.mbs2.e11031.etaksi.entitet.Putnik>"
	scope="request" />

<html>
<head>
<title><fmt:message key="prikazPutnika" /></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link href="css/tema.css" rel="stylesheet" type="text/css" />
<style type="text/css">
div#brisanje {
	background: #def3ca;
	margin: 3px;
	width: 80px;
	display: none;
	float: left;
	text-align: center;
}

button {
	background: #def3ca;
	margin: 3px;
	width: 80px;
	display: none;
	float: left;
	text-align: center;
}
</style>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
	<table class="zaglavlje">
		<thead>
			<tr>
				<th><a
					href="/${initParam.nazivAplikacije}/PromenaPutnikaKontroler"><fmt:message
							key="promenaPutnika" /></a></th>
				<th><a
					href="/${initParam.nazivAplikacije}/jsp/promenaLicnihPodataka.jsp"><fmt:message
							key="promenaPodataka" /></a></th>
				<th><a
					href="/${initParam.nazivAplikacije}/jsp/promenaLozinke.jsp"><fmt:message
							key="promenaLozinke" /></a></th>
				<th><a href="/${initParam.nazivAplikacije}/OdjavaKontroler">
						<fmt:message key="odjava" />
				</a></th>
			</tr>
		</thead>
	</table>
	<table class="glavna">
		<thead>
			<tr>
				<th></th>
				<th><fmt:message key="jmbg" /></th>
				<th><fmt:message key="ime" /></th>
				<th><fmt:message key="prezime" /></th>
				<th><fmt:message key="korisnickoIme" /></th>
				<th><fmt:message key="ukupnaCenaKoriscenihUsluga" /></th>
			</tr>
		</thead>
		<tbody>
			<c:forEach var="putnik" items="${putnici}" varStatus="status">
				<tr>
					<td>${status.count}</td>
					<td>${putnik.jmbg}</td>
					<td>${putnik.ime}</td>
					<td>${putnik.prezime}</td>
					<td>${putnik.ukupnaCenaKoriscenihUsluga}</td>
					<td>
						<div id="brisanjePutnika${putnikId}">
							<span><fmt:message key="daLiSteSigurni" />?</span>
							<button id="da${putnikId}">
								<fmt:message key="da" />
							</button>
							<button id="ne${putnikId}">
								<fmt:message key="ne" />
							</button>
						</div>
					</td>
					<td><input id="obrisi${putnikId}" type="button"
						value='<fmt:message key="obrisi"/>' /></td>
					<td><input id="promeni${putnikId}" type="button"
						value='
					<fmt:message key="promeni" />' /></td>
				</tr>

				<script>
					$("#obrisi${putnikId}").click(function () {
						$("#brisanjePutnika${putnikId}").show("fast");
					
						$("brisanjePutnika${putnikId} > span").show("fast");
						
						$("da${putnikId}").first().show("fast", function showNext() {
							$(this).next("button").show("fast", showNext);
						});
						
						$("#promeni${putnikId}").hide();
						$("#obrisi${putnikId}").hide();
					});
					
					$("#da${putnikId}").click(function () {
						window.location = location.host + "/PrikazPutnikaKontroler?obrisi=${putnikId}";
					)};
					
					$("#ne${putnikId}").click(function () {
						$("#brisanjePutnika${putnikId}").hide();
						$("#obrisi${putnikId}").show();
						$("#promeni${putnikId}").show();
					});
				</script>
			</c:forEach>
		</tbody>
	</table>
</body>
</html>
